package everydayone.canMeasureWater;
/**
 * @Date 2020/03/21
 * @author 王光浩
 * @Thinking 使用数学方法
 */
public class MyMethodOne {
	public boolean canMeasureWater(int x, int y, int z) {
		int min=Math.min(x, y);
		int max=Math.max(x, y);
		if(z==0)return true;
		if(z<min || z>(min+max))return false;		
		if(min==0)return z==max;
		int remain=max%min;
		while(remain!=0) {
			if((max-z)%min==0)return true;
			max+=remain;
			remain=max%min;
		}
		return (max-z)%min==0;
    }
}
